package com.cy.pj.common.service;

import com.cy.pj.common.cache.Cache;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

@Service

public class CacheService  {
//    @Autowired
//    @Qualifier("softCache")
    private Cache cache;
    //    @Autowired//可以省略，当且仅当只有这一个构造函数
    /*public CacheService() {
    }*/


//@Qulifier不能描述构造方法，但能描述变量
    public CacheService(@Qualifier("softCache")Cache cache) {
        this.cache = cache;
    }
//    @Autowired
    //@Autowired ，加上后，依然需要@qulifier
    public void setCache(Cache cache) {
        this.cache = cache;
    }


    public Cache getCache() {
        return cache;
    }
}
